<?php
ob_start();

$lang = 'en';

if(!isset($_GET['step'])) {
    $step = 'introduction';
} else {
    $step = basename($_GET['step']);
}

require_once('../settings.php');
require_once('language/' . $lang . '.php');
require_once('steps/' . $step . '.php');

function ypStep($step = 'introduction') {
	global $language;
	$list_step = array('introduction', 'requirements', 'installdatabase', 'configuration', 'end');
	if (!in_array($step, $list_step)) {
		$step = 'introduction';
	}
	$key = array_keys($list_step, $step);
	$key = $key[0];

	if($step == 'introduction') {
		echo '<li class="selected">'. $language['menu_introduction'] .'</li>';
	} else {
		if ($key > 0) {
			echo '<li><a href="index.php?step=introduction">'. $language['menu_introduction'] .'</a></li>';
		} else {
			echo '<li>'. $language['menu_introduction'] .'</li>';
		}
	}

	if($step == 'requirements') {
		echo '<li class="selected">'. $language['menu_requirements'] .'</li>';
	} else {
		if ($key > 1) {
			echo '<li><a href="index.php?step=requirements">'. $language['menu_requirements'] .'</a></li>';
		} else {
			echo '<li>'. $language['menu_requirements'] .'</li>';
		}
	}
	if($step == 'installdatabase') {
		echo '<li class="selected">'. $language['menu_installdatabase'] .'</li>';
	} else {
		if ($key > 2) {
			echo '<li><a href="index.php?step=installdatabase">'. $language['menu_installdatabase'] .'</a></li>';
		} else {
			echo '<li>'. $language['menu_installdatabase'] .'</li>';
		}
	}
	if($step == 'configuration') {
		echo '<li class="selected">'. $language['menu_configuration'] .'</li>';
	} else {
		if ($key > 3) {
			echo '<li><a href="index.php?step=configuration">'. $language['menu_configuration'] .'</a></li>';
		} else {
			echo '<li>'. $language['menu_configuration'] .'</li>';
		}
	}

	if($step == 'end') {
		echo '<li class="selected">'. $language['menu_end'] .'</li>';
	} else {
		echo '<li>'. $language['menu_end'] .'</li>';
	}
}

echo '<?xml version="1.0" encoding="UTF-8" ?>';

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
                <link rel="stylesheet" type="text/css" media="all" href="style/style.css"/>
		<title><?= $language['title'] ?></title>
	</head>
	<body>

		<div class="header">
			<h2>
				<? echo toptext(); ?>
			</h2>
		</div>
		<div class="container">
			<div id="sidebar" class="sidebar">
				<ul class="sidelist">
					<?php ypStep($step); ?>
				</ul>
			</div>
			<div id="content" class="content">
				  <?php getContent(); ?>
			</div>
		</div>
	</body>
</html>